<?php

include(dirname(__FILE__).'/../../bootstrap/functional.php');

$browser = new BlogTestFunctional(new sfBrowser());
$browser->loadFixtures();
$browser->
  
  get('/en/contact')->

  with('request')->begin()->
    isParameter('module', 'static')->
    isParameter('action', 'contact')->
  end()->

  with('response')->begin()->
    isStatusCode(200)->
    isValid(true)->
  end()->
  
  click('.content input[type="submit"]', array('contact' => array(
    'name' => 'Thomas',
    'email' => 'thomas@example.com',
    'subject' => 'We are hiring',
    'message' => 'Hey guy, we are hiring. Would you like to join us?'
  )), array('_with_csrf' => true))->
  
  with('form')->hasErrors(false)->
  with('mailer')->hasSent(1)->
  with('response')->isRedirected()->
  followRedirect()->
  with('response')->isValid(true)->
  
  get('/en/foo')->
  with('response')->isStatusCode(404)
;
